#ifndef _ADCM_DOMAIN_H
#define _ADCM_DOMAIN_H

/******************************************************************************
** @file	ADCM_Domain.h
** @author  Natty Choque Choque
**
** @date	Agost 26, 2010
**
** @desc	This class represent the conecction in a active directory and load 
**			all computer into domain especific.
*			
**
******************************************************************************/

#include "activeds.h"
#include "atlbase.h"
#include <iostream>
#include <comutil.h>
#include <string>
#include <vector>
#include "adcm_computer.h"
#include "adcm_common.h"

using namespace std;

class ADCMEXPORT ADCM_Domain 
{
private:
    /*
    * Method that return a Distinguished Name from a Fully Qualified Domain Name.
	*
    * @param dn Is the new domain name for distinguished.
    */
    void
    fqdnToDN(wstring & dn);

public:
    /*
	* Class constructor
	*/
    ADCM_Domain(wstring&, wstring&);

	/*
	* Class destructor
	*/
    ~ADCM_Domain();

	/**
     * Method that return collection of computers into specific domain.
	 *
	 * @param user Is name of user.
	 * @param pass Is password of user.
	 * @param fdnq Is full domain name query for cosult of LDAP.
	 * @param computers Is a collection of list of computers.
     */
    int
	loadComputers(const wstring & user, 
	              const wstring & pass, 
				  vector<ADCM_Computer> & computers);

public:
	/*
	* This method return the controller domain of the computer.
	*/
    const wstring
	getDc()
	{
		return _dc;
	}

	/*
	* This method sets the controller domain of the computer.
	*
	* @param value Is the value of controller domain.
	*/
    void
	setDc(wstring& value)
	{
		_dc = value;
	}

    /*
	* This method return the Fully Qualified Domain Name.
	*/
    const wstring
	getFqdn()
	{
		return _fqdn;
	}

	/*
	* This method sets the Fully Qualified Domain Name.
	*
	* @param value Is the value of Fully Qualified Domain Name.
	*/
    void
	setFqdn(wstring& value)
	{
		_fqdn = value;
	}
   
	/*
	* This method gets the domain identefier for database.
	*
	*/
	int
	getDomainID()
	{
		return _domainID;
	}

	/*
	* This method sets the domain identefier for database.
	*
	* @param domid Is the value of domain identefier for database.
	*/
    void
	setDomainID(int domid)
	{
		_domainID = domid;
	}
private:
    /**
     * Field to represent a Domain Controller name.
     */
    wstring _dc;

    /**
     * Field to represent a Fully Qualified Domain Name.
     */
    wstring _fqdn;
	
    /**
     * Field to represent the domain identefier for database.
     */
    int _domainID;	
};

#endif
